package com.example.test0601.controller;

import com.example.test0601.bean.UserBean;
import com.example.test0601.service.UserService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.annotation.Resource;

@Controller
public class LoginController {

    @Resource
    UserService userService;

    @RequestMapping(value = "/login")
    public  String login(){
        return "login";
    }

    @RequestMapping(value = "/loginAction",method = RequestMethod.POST)
    public String loginAction(UserBean userBean){
        UserBean userBean1 =  userService.getInfo(userBean.getName(),userBean.getPassword());
        if (userBean1 == null){
            return  "error";
        }else {
            return "success";
        }
    }
}
